package com.mt.checkerin.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.mt.checkerin.model.Greeting;

@Controller
public class GreetingController {
	
	@RequestMapping(value="/greeting", method=RequestMethod.GET)
	public String greetingFrom(Model mdl) {
		mdl.addAttribute("greeting", new Greeting());
		return "greeting";
	}
	
	@RequestMapping(value="/greeting", method=RequestMethod.POST)
	public String greetingSubmit(@ModelAttribute Greeting grt, Model mdl) {
		mdl.addAttribute("greeting", grt);
		return "greeting";
	}
	
}
